<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    // 数组对象去重
    let arr = [
        {id:1,name:'张三'},
        {id:2,name:'李四'},
        {id:1,name:'张三'},
        {id:3,name:'王五'},
    ]
    arr.filter((item,index,arr)=>{
        //0                                0
        //1                                1
        //0                                2
        //3                                3
        if(arr.findIndex(i => i.id == item.id) == index){
            return item
        }
    })
    arr.reduce((cur,item)=>{
        let x = cur.find(i => i.id == item.id)
        if(!x){
            return cur.concat(item)
        }else{
            return cur
        }
    },[])

</script>